{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pandas import Series, DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "apply_demo.csv     demo_duplicate.csv iris.csv           \u001b[31mmovie_metadata.csv\u001b[m\u001b[m\r\n"
     ]
    }
   ],
   "source": [
    "!ls ../homework"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv('../homework/demo_duplicate.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "del df['Unnamed: 0']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15956"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3989"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1000"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df['Seqno'].unique())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Price</th>\n",
       "      <th>Seqno</th>\n",
       "      <th>Symbol</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411962</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411962</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411964</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411964</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1642.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411964</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1642.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411964</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Price  Seqno Symbol        time\n",
       "0  1623.0    0.0   APPL  1473411962\n",
       "1  1623.0    0.0   APPL  1473411962\n",
       "2  1623.0    0.0   APPL  1473411963\n",
       "3  1623.0    0.0   APPL  1473411963\n",
       "4  1649.0    1.0   APPL  1473411963\n",
       "5  1649.0    1.0   APPL  1473411963\n",
       "6  1649.0    1.0   APPL  1473411964\n",
       "7  1649.0    1.0   APPL  1473411964\n",
       "8  1642.0    2.0   APPL  1473411964\n",
       "9  1642.0    2.0   APPL  1473411964"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       False\n",
       "1        True\n",
       "2        True\n",
       "3        True\n",
       "4       False\n",
       "5        True\n",
       "6        True\n",
       "7        True\n",
       "8       False\n",
       "9        True\n",
       "10       True\n",
       "11       True\n",
       "12      False\n",
       "13       True\n",
       "14       True\n",
       "15       True\n",
       "16      False\n",
       "17       True\n",
       "18       True\n",
       "19       True\n",
       "20      False\n",
       "21       True\n",
       "22       True\n",
       "23       True\n",
       "24      False\n",
       "25       True\n",
       "26       True\n",
       "27       True\n",
       "28      False\n",
       "29       True\n",
       "        ...  \n",
       "3959     True\n",
       "3960     True\n",
       "3961    False\n",
       "3962     True\n",
       "3963     True\n",
       "3964     True\n",
       "3965    False\n",
       "3966     True\n",
       "3967     True\n",
       "3968     True\n",
       "3969    False\n",
       "3970     True\n",
       "3971     True\n",
       "3972     True\n",
       "3973    False\n",
       "3974     True\n",
       "3975     True\n",
       "3976     True\n",
       "3977    False\n",
       "3978     True\n",
       "3979     True\n",
       "3980     True\n",
       "3981    False\n",
       "3982     True\n",
       "3983     True\n",
       "3984     True\n",
       "3985    False\n",
       "3986     True\n",
       "3987     True\n",
       "3988     True\n",
       "Name: Seqno, Length: 3989, dtype: bool"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Seqno'].duplicated()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Price</th>\n",
       "      <th>Seqno</th>\n",
       "      <th>Symbol</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411964</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1642.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411965</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1636.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411966</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1669.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411967</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1639.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411968</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1611.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>1660.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411970</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>1657.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>1509.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411972</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>1514.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411973</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>1676.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>1596.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411975</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>1527.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411975</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>1643.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411976</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63</th>\n",
       "      <td>1632.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411977</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>1595.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>1565.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>1521.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>1501.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411982</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>1579.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411983</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>1511.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411983</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>1513.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>1687.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>1539.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411987</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>1682.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>107</th>\n",
       "      <td>1534.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411989</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>111</th>\n",
       "      <td>1628.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>115</th>\n",
       "      <td>1582.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411991</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>1540.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411991</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3872</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>970.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3876</th>\n",
       "      <td>1696.0</td>\n",
       "      <td>971.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412934</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3880</th>\n",
       "      <td>1596.0</td>\n",
       "      <td>972.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3884</th>\n",
       "      <td>1664.0</td>\n",
       "      <td>973.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412936</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3888</th>\n",
       "      <td>1539.0</td>\n",
       "      <td>974.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3892</th>\n",
       "      <td>1654.0</td>\n",
       "      <td>975.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412938</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3896</th>\n",
       "      <td>1573.0</td>\n",
       "      <td>976.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3900</th>\n",
       "      <td>1695.0</td>\n",
       "      <td>977.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3904</th>\n",
       "      <td>1584.0</td>\n",
       "      <td>978.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3908</th>\n",
       "      <td>1607.0</td>\n",
       "      <td>979.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412942</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3912</th>\n",
       "      <td>1676.0</td>\n",
       "      <td>980.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3916</th>\n",
       "      <td>1665.0</td>\n",
       "      <td>981.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3920</th>\n",
       "      <td>1540.0</td>\n",
       "      <td>982.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3924</th>\n",
       "      <td>1546.0</td>\n",
       "      <td>983.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3928</th>\n",
       "      <td>1646.0</td>\n",
       "      <td>984.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412946</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3932</th>\n",
       "      <td>1648.0</td>\n",
       "      <td>985.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412948</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3936</th>\n",
       "      <td>1647.0</td>\n",
       "      <td>986.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412949</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3940</th>\n",
       "      <td>1602.0</td>\n",
       "      <td>987.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412950</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3944</th>\n",
       "      <td>1562.0</td>\n",
       "      <td>988.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3948</th>\n",
       "      <td>1629.0</td>\n",
       "      <td>989.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3952</th>\n",
       "      <td>1683.0</td>\n",
       "      <td>990.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3956</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>991.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412954</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3960</th>\n",
       "      <td>1698.0</td>\n",
       "      <td>992.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412955</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3964</th>\n",
       "      <td>1566.0</td>\n",
       "      <td>993.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412955</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3968</th>\n",
       "      <td>1597.0</td>\n",
       "      <td>994.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412957</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3972</th>\n",
       "      <td>1641.0</td>\n",
       "      <td>995.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412958</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3976</th>\n",
       "      <td>1581.0</td>\n",
       "      <td>996.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3980</th>\n",
       "      <td>1674.0</td>\n",
       "      <td>997.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3984</th>\n",
       "      <td>1680.0</td>\n",
       "      <td>998.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3988</th>\n",
       "      <td>1509.0</td>\n",
       "      <td>999.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473412962</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Price  Seqno Symbol        time\n",
       "3     1623.0    0.0   APPL  1473411963\n",
       "7     1649.0    1.0   APPL  1473411964\n",
       "11    1642.0    2.0   APPL  1473411965\n",
       "15    1636.0    3.0   APPL  1473411966\n",
       "19    1669.0    4.0   APPL  1473411967\n",
       "23    1639.0    5.0   APPL  1473411968\n",
       "27    1611.0    6.0   APPL  1473411969\n",
       "31    1660.0    7.0   APPL  1473411970\n",
       "35    1657.0    8.0   APPL  1473411971\n",
       "39    1509.0    9.0   APPL  1473411972\n",
       "43    1514.0   10.0   APPL  1473411973\n",
       "47    1676.0   11.0   APPL  1473411974\n",
       "51    1596.0   12.0   APPL  1473411975\n",
       "55    1527.0   13.0   APPL  1473411975\n",
       "59    1643.0   14.0   APPL  1473411976\n",
       "63    1632.0   15.0   APPL  1473411977\n",
       "67    1595.0   16.0   APPL  1473411979\n",
       "71    1565.0   17.0   APPL  1473411979\n",
       "75    1521.0   18.0   APPL  1473411980\n",
       "79    1501.0   19.0   APPL  1473411982\n",
       "83    1579.0   20.0   APPL  1473411983\n",
       "87    1511.0   21.0   APPL  1473411983\n",
       "91    1513.0   22.0   APPL  1473411985\n",
       "95    1687.0   23.0   APPL  1473411986\n",
       "99    1539.0   24.0   APPL  1473411987\n",
       "103   1682.0   25.0   APPL  1473411988\n",
       "107   1534.0   26.0   APPL  1473411989\n",
       "111   1628.0   27.0   APPL  1473411990\n",
       "115   1582.0   28.0   APPL  1473411991\n",
       "119   1540.0   29.0   APPL  1473411991\n",
       "...      ...    ...    ...         ...\n",
       "3872  1649.0  970.0   APPL  1473412933\n",
       "3876  1696.0  971.0   APPL  1473412934\n",
       "3880  1596.0  972.0   APPL  1473412935\n",
       "3884  1664.0  973.0   APPL  1473412936\n",
       "3888  1539.0  974.0   APPL  1473412937\n",
       "3892  1654.0  975.0   APPL  1473412938\n",
       "3896  1573.0  976.0   APPL  1473412939\n",
       "3900  1695.0  977.0   APPL  1473412939\n",
       "3904  1584.0  978.0   APPL  1473412941\n",
       "3908  1607.0  979.0   APPL  1473412942\n",
       "3912  1676.0  980.0   APPL  1473412943\n",
       "3916  1665.0  981.0   APPL  1473412943\n",
       "3920  1540.0  982.0   APPL  1473412945\n",
       "3924  1546.0  983.0   APPL  1473412945\n",
       "3928  1646.0  984.0   APPL  1473412946\n",
       "3932  1648.0  985.0   APPL  1473412948\n",
       "3936  1647.0  986.0   APPL  1473412949\n",
       "3940  1602.0  987.0   APPL  1473412950\n",
       "3944  1562.0  988.0   APPL  1473412951\n",
       "3948  1629.0  989.0   APPL  1473412951\n",
       "3952  1683.0  990.0   APPL  1473412953\n",
       "3956  1649.0  991.0   APPL  1473412954\n",
       "3960  1698.0  992.0   APPL  1473412955\n",
       "3964  1566.0  993.0   APPL  1473412955\n",
       "3968  1597.0  994.0   APPL  1473412957\n",
       "3972  1641.0  995.0   APPL  1473412958\n",
       "3976  1581.0  996.0   APPL  1473412959\n",
       "3980  1674.0  997.0   APPL  1473412960\n",
       "3984  1680.0  998.0   APPL  1473412961\n",
       "3988  1509.0  999.0   APPL  1473412962\n",
       "\n",
       "[1000 rows x 4 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.drop_duplicates(['Seqno'],keep='last')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Price</th>\n",
       "      <th>Seqno</th>\n",
       "      <th>Symbol</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411962</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411962</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1623.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1649.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>APPL</td>\n",
       "      <td>1473411963</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Price  Seqno Symbol        time\n",
       "0  1623.0    0.0   APPL  1473411962\n",
       "1  1623.0    0.0   APPL  1473411962\n",
       "2  1623.0    0.0   APPL  1473411963\n",
       "3  1623.0    0.0   APPL  1473411963\n",
       "4  1649.0    1.0   APPL  1473411963"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
